<template>
  <div>
    <!--增加-->
    <div class="tools-con1">
      <ul class="tools1 tools">
        <li class="add" @click="open1 = true"><span>增加</span></li>
      </ul>
    </div>
    <Modal
      title="新增医生"
      v-model="open1"
      :mask-closable="false">
      <div>
        <p class="p">姓名:<Input v-model="value" placeholder="请输入姓名" style="width: 90%"/></p>
        <p class="p">科室:<Input v-model="value" placeholder="请输入科室" style="width: 90%"/></p>
        <p class="p">医院:<Input v-model="value" placeholder="请输入医院" style="width: 90%"/></p>
      </div>
    </Modal>

    <!--删除-->
    <div class="tools-con2">
      <ul class="tools2 tools">
        <li class="del" @click="open2 = true"><span>删除</span></li>
      </ul>
    </div>
    <Modal
      title="删除"
      v-model="open2"
      :mask-closable="false">
      <p>是否确认删除？</p>
    </Modal>
    <!--修改-->
    <div class="tools-con3">
      <ul class="tools3 tools">
        <li class="change" @click="open3 = true"><span>修改</span></li>
      </ul>
    </div>
    <Modal
      title="修改"
      v-model="open3"
      :mask-closable="false">
      <div>
        <p class="p">姓名:<Input value="李艳波	" placeholder="请输入姓名" style="width: 90%"/></p>
        <p class="p">科室:<Input value="内分泌科" placeholder="请输入科室" style="width: 90%"/></p>
        <p class="p">医院:<Input value="哈尔滨医科大学附属第一医院" placeholder="请输入医院" style="width: 90%"/></p>
      </div>
    </Modal>

    <div :class="item.toolscon" v-for="item in items">
      <ul :class="item.tools" class="tools">
        <li :class="item.class"><span>{{item.name}}</span></li>
      </ul>
    </div>

    <!--作为参会者-->
    <div class="tools-con5">
      <ul class="tools5 tools">
        <li class="visit" @click="open6 = true"><span>作为参会者</span></li>
      </ul>
    </div>
    <Modal
      title="会议"
      v-model="open6"
      @on-ok="ok"
      :mask-closable="false">
      <div>
        <span>请选择邀请选中人员参加的会议：</span>
        <div class="center">
          <ul>
            <li class="tab-content-item">
              <el-checkbox v-model="checked"></el-checkbox>
              <div>
                <dl class="ml10 flex-1">
                  <dt class="clickable">中华医学会第十七次全国内分泌学学术会议</dt>
                  <dd data-v-dcc0fdcc="" class="mt5">2018-11-22</dd>
                </dl>
                <span>广州</span>
              </div>
            </li>
            <li class="tab-content-item">
              <el-checkbox v-model="checked1"></el-checkbox>
              <div>
                <dl class="ml10 flex-1">
                  <dt class="clickable">2018中国肿瘤学大会</dt>
                  <dd data-v-dcc0fdcc="" class="mt5">2018-08-17</dd>
                </dl>
                <span>北京</span>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </Modal>

    <!--发送-->
    <div class="tools-con7">
      <ul class="tools7 tools">
        <li class="mail" @click="open4 = true"><span>发送邮件</span></li>
      </ul>
    </div>
    <Modal
      title="邮件"
      v-model="open4"
      @on-ok="ok"
      :mask-closable="false">
      <div>
        <p class="p"><span style="display: inline-block;width: 15%">发送人：</span><Input value="" placeholder=""
                                                                                      style="width: 85%"/></p>
        <p class="p"><span style="display: inline-block;width: 15%">主题:</span><Input value="" placeholder=""
                                                                                     style="width: 85%"/></p>
        <p class="p"><span style="display: inline-block;width: 15%">内容: </span><Input type="textarea" placeholder=""
                                                                                      style="width: 85%"/></p>
      </div>
    </Modal>

    <!--聚类-->
    <div class="tools-con8">
      <ul class="tools8 tools">
        <li class="visit" @click="open5 = true"><span>聚类</span></li>
      </ul>
    </div>
    <Modal
      title="聚类"
      v-model="open5"
      :mask-closable="false" width="800">
      <div class="center">
        <el-row :gutter="20">
          <el-col :span="24" style="padding-top: 20px;">
            <Steps :current="current">
              <Step title="步骤1" content="输入聚类的名称"></Step>
              <Step title="步骤2" content="选择聚类方式"></Step>
              <Step title="步骤3" content="选择聚类维度"></Step>
              <Step title="步骤4" content="设置聚类目标数"></Step>
            </Steps>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24" style="padding-top: 20px;">
            <div v-show="show1">
              <el-row :gutter="20">
                <el-col :span="24" style="padding-top: 10px;padding-bottom: 0px">
                  <el-col :span="12">
                    <span class="spn" style="width: 80px;">聚类名称:</span>
                    <Input v-model="message5" placeholder="请输入聚类名称" style="width: 300px"/>
                  </el-col>
                  <el-col :span="12">
                    <span class="spn" style="width: 80px;">备注:</span>
                    <Input v-model="message6" placeholder="备注" style="width: 300px"/>
                  </el-col>
                </el-col>
              </el-row>
            </div>
            <div v-show="show2">
              <el-switch
                @change="selects"
                style="display: block"
                v-model="value3"
                active-color="#409EFF"
                inactive-color="#409EFF"
                active-text="通用图谱"
                inactive-text="疾病图谱">
              </el-switch>
              <div>
                <div v-show="show5">
                  <CheckboxGroup v-model="fruit">
                    <Checkbox :label=doctorlabel v-for="doctorlabel in doctorlabel" style="padding: 10px 0 0 10px">
                      <div class="frame">
                        <span>{{doctorlabel}}</span>
                      </div>
                    </Checkbox>
                  </CheckboxGroup>
                </div>
                <div v-show="show6">
                  <CheckboxGroup v-model="fruit1">
                    <Checkbox :label=doctorlabel1 v-for="doctorlabel1 in doctorlabel1" style="padding: 10px 0 0 10px">
                      <div class="frame">
                        <span>{{doctorlabel1}}</span>
                      </div>
                    </Checkbox>
                  </CheckboxGroup>
                </div>
              </div>
            </div>
            <div v-show="show3">
              <jlLabel></jlLabel>
            </div>
            <div v-show="show4">
              聚类数量：
              <InputNumber :max="10" :min="1" v-model="value1" style="width: 300px"></InputNumber>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24" style="padding-top: 20px;">
            <el-button style="padding: 5px;" id="up" type="primary" @click="ups">上一步</el-button>
            <el-button style="padding: 5px;float: right;" id="next" type="primary" @click="next">
              下一步
            </el-button>
          </el-col>
        </el-row>
      </div>
      <div slot="footer">
      </div>

      <div>
        <Spin size="large" fix v-if="spinShow">聚类计算中...</Spin>
      </div>
    </Modal>

    <Modal title="生成聚类" v-model="open7" :mask-closable="false" @on-ok="ok">
      <el-row :gutter="20">
        <el-col :span="24" class="h">
          <el-col :span="22">
            <h3>基本信息</h3>
          </el-col>
        </el-col>

        <el-col :span="24" style="padding-top: 10px;padding-bottom: 0px">
          <el-col :span="12">
            <div>
              <span class="spn">聚类名称:</span>
              <Input v-model="message5" disabled="disabled" placeholder="" style="width: 150px"/>
            </div>
          </el-col>
          <el-col :span="12">
            <div>
              <span class="spn">备注:</span>
              <Input v-model="message6" disabled="disabled" placeholder="" style="width: 150px"/>
            </div>
          </el-col>
        </el-col>
        <!--        <el-col :span="24" style="padding-top: 10px;padding-bottom: 0px">
                  <el-col :span="12">
                    <div>
                      <span class="spn" style="width: 70px;">医生数量:</span>
                      <Input v-model="message7" disabled="disabled" placeholder="" style="width: 150px"/>
                    </div>
                  </el-col>
                  <el-col :span="12">
                    <div>
                      <span class="spn" style="width: 70px;">创建人:</span>
                      <Input v-model="message8" disabled="disabled" placeholder="" style="width: 150px"/>
                    </div>
                  </el-col>
                </el-col>-->
        <el-col :span="24" style="padding-top: 10px;padding-bottom: 10px">
          <el-col :span="12">
            <div>
              <span class="spn">聚类数量:</span>
              <Input v-model="value1" disabled="disabled" placeholder="" style="width: 150px"/>
            </div>
          </el-col>
          <el-col :span="12">
            <div style="line-height: 32px">
              <span class="spn">聚类方式:</span>
              <span class="spn">通用图谱</span>
            </div>
          </el-col>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="24" class="h">
          <el-col :span="22">
            <h3>标签</h3>
          </el-col>
        </el-col>
        <el-col :span="24" style="padding: 10px">
          <span style="padding: 5px;color:#fff" class="san" v-for="label1 in label1">{{label1}}</span>
        </el-col>
      </el-row>
    </Modal>

  </div>
</template>

<script>
  import jlLabel from './jlLabel'
  import bus from '../bus';

  export default {
    components: {
      jlLabel
    },
    data() {
      return {
        open1: false,
        open2: false,
        open3: false,
        open4: false,
        open5: false,
        open6: false,
        open7: false,
        div: false,
        items: [
          /*          {toolscon:'tools-con1',tools:'tools1',click:'open1',class:'add',name:'增加'},
                    {toolscon:'tools-con2',tools:'tools2',click:'open2',class:'del',name:'删除'},
                    {toolscon:'tools-con3',tools:'tools3',click:'open3',class:'change',name:'修改'},*/
          {toolscon: 'tools-con4', tools: 'tools4', class: 'speak', name: '作为讲者'},
          /*          {toolscon:'tools-con5',tools:'tools5',class:'attend',name:'作为参会者'},*/
          {toolscon: 'tools-con6', tools: 'tools6', class: 'visit', name: '拜访'},
          /*          {toolscon:'tools-con8',tools:'tools8',class:'visit',name:'聚类'},*/
          /*          {toolscon:'tools-con7',tools:'tools7',class:'mail',name:'发送邮件'},*/
        ],
        value: '',
        cityList: [
          {
            value: '乳腺癌2017Q4',
            label: '乳腺癌2017Q4'
          },
          {
            value: '帕金森2017Q4',
            label: '帕金森2017Q4'
          },
          {
            value: '抗生素2018Q4',
            label: '抗生素2018Q4'
          },
          {
            value: '糖尿病2017Q4',
            label: '糖尿病2017Q4'
          },
          {
            value: '糖尿病2017Q4 for Medical',
            label: '糖尿病2017Q4 for Medical'
          },
          {
            value: '糖尿病2018Q4',
            label: '糖尿病2018Q4'
          },
        ],
        cityList1: [
          {
            value: '0~5',
            label: '0~5'
          },
          {
            value: '5~10',
            label: '5~10'
          },
          {
            value: '10~15',
            label: '10~15'
          },
          {
            value: '>15',
            label: '>15'
          }
        ],
        model1: '',
        model2: '',
        message1: '手工filter选择保存',
        message2: '上海',
        message3: '医生',
        message4: '内分泌科',
        message5: '',
        message6: '',
        message7: '',
        message8: '',
        message9: '',
        jlLbl: false,
        checked: "",
        checked1: "",
        meetingId: '1027',
        fruit: [],
        fruit1: [],
        doctorlabel: ["影响力", "学术水平", "医生潜力", "合作意愿", "渠道偏好", "内容偏好",],
        doctorlabel1: ["个人Perception得分", "Perception得分", "治疗方案偏好", "用药偏好"],
        label1: ['糖尿病口服药治疗'],
        current: 0,
        show1: true,
        show2: false,
        show3: false,
        show4: false,
        show5: true,
        show6: false,
        value1: 1,
        value3: true,
        spinShow: false,
      }
    },
    created() {
      bus.$on('fruit', receive => {
        for (var i = 0; i < receive.length; i++) {
          this.label1.push(receive[i])
        }
      });
    },
    watch: {
      model1() {
        if (this.model1 != "") {
          this.jlLbl = true
        }
      }
    },
    methods: {
      selects() {
        this.show5 = !this.show5
        this.show6 = !this.show6
      },
      ok() {
        this.spinShow = true;
        const data = {
          name: this.message5,
          therapyArea: "临床心理科",
          time: "2018-05-09",
          peopleNum: "600",
          tagNum: this.label1.length
        };
        let a = this;
        this.$axios({
          method: 'POST',
          headers: {'content-type': 'application/x-www-form-urlencoded'},
          dataType: 'json',
          data: JSON.stringify(data),
          url: "http://tlpt.yutaolife007.com/huimeidata/insertCluster",
        }).then(function (response) {
          a.$Message.success('聚类成功');
          setTimeout(function () {
            this.open5 = false;
            location.reload();
          }, 2000);
        })

        /*                this.div = true;
                        if (this.checked || this.checked1 === true) {
                          const data = {
                            'meetingId': 1027,
                            'doctorsId': [3, 6, 13, 19]
                          };
                          const options = {
                            method: 'POST',
                            headers: {'content-type': 'application/x-www-form-urlencoded'},
                            dataType: 'json',
                            data: JSON.stringify(data),
                            url: 'http://tlpt.yutaolife007.com/huimeidata/insertDocsMeeting',
                          };
                          this.$axios(options).then(function (response) {
                            console.log(response);
                          }).catch(function (error) {
                            console.log(error);
                          });
                        }*/
      },
      next() {
        if (this.current < 3) {
          this.current += 1;
          if (this.current == 1) {
            this.show1 = false;
            this.show2 = true;
            this.show3 = false;
            this.show4 = false;
          } else if (this.current == 2) {
            this.show1 = false;
            this.show2 = false;
            this.show3 = true;
            this.show4 = false;
          } else if (this.current == 3) {
            this.show1 = false;
            this.show2 = false;
            this.show3 = false;
            this.show4 = true;
            this.current += 1;
          }
        } else if (this.current == 4) {
          this.open7 = true;
          for (var i = 0; i < this.fruit.length; i++) {
            this.label1.push(this.fruit[i])
          }
          for (var i = 0; i < this.fruit1.length; i++) {
            this.label1.push(this.fruit1[i])
          }
        }
      },
      ups() {
        if (this.current !== 0) {
          this.current -= 1;
          if (this.current == 0) {
            this.show1 = true;
            this.show2 = false;
            this.show3 = false;
            this.show4 = false;
          } else if (this.current == 1) {
            this.show1 = false;
            this.show2 = true;
            this.show3 = false;
            this.show4 = false;
          } else if (this.current == 2) {
            this.show1 = false;
            this.show2 = false;
            this.show3 = true;
            this.show4 = false;
          } else if (this.current == 3) {
            this.show1 = false;
            this.show2 = false;
            this.show3 = false;
            this.show4 = true;
          }
        }
      }
    },
  }
</script>


<style scoped>
  @import '../../assets/index.css';
  @import '../../assets/style.css';

  .tools > li {
    color: #fff;
    list-style-type: none;
    padding: 0 8px 0 40px;
    border: 2px solid #fff;
    line-height: 40px;
    border-radius: 3px;
    font-size: 18px;
  }

  /*一*/
  .tools-con1 {
    position: absolute;
    right: 0;
    overflow: hidden;
    z-index: 99;
  }

  .tools1 {
    margin-right: -47px;
  }

  .tools1:hover {
    width: 150px;
  }

  /*二*/
  .tools-con2 {
    position: absolute;
    right: 0;
    top: 50px;
    overflow: hidden;
    z-index: 99;
  }

  .tools2 {
    margin-right: -47px;
  }

  .tools2:hover {
    width: 150px;
  }

  /*三*/
  .tools-con3 {
    position: absolute;
    right: 0;
    top: 100px;
    overflow: hidden;
    z-index: 99;
  }

  .tools3 {
    margin-right: -47px;
  }

  .tools3:hover {
    width: 150px;
  }

  /*四*/
  .tools-con4 {
    position: absolute;
    right: 0;
    top: 150px;
    overflow: hidden;
    z-index: 99;
  }

  .tools4 {
    margin-right: -83px;
  }

  .tools4:hover {
    width: 210px;
  }

  /*五*/
  .tools-con5 {
    position: absolute;
    right: 0;
    top: 200px;
    overflow: hidden;
    z-index: 99;
  }

  .tools5 {
    margin-right: -100px;
  }

  .tools5:hover {
    width: 250px;
  }

  /*六*/
  .tools-con6 {
    position: absolute;
    right: 0;
    top: 250px;
    overflow: hidden;
    z-index: 99;
  }

  .tools6 {
    margin-right: -47px;
  }

  .tools6:hover {
    width: 150px;
  }

  /*七*/
  .tools-con7 {
    position: absolute;
    right: 0;
    top: 300px;
    overflow: hidden;
    z-index: 99;
  }

  .tools7 {
    margin-right: -83px;
  }

  .tools7:hover {
    width: 210px;
  }

  .p {
    padding: 10px 0;
    font-size: 15px;
  }

  /*八*/
  .tools-con8 {
    position: absolute;
    right: 0;
    top: 350px;
    overflow: hidden;
    z-index: 99;
  }

  .tools8 {
    margin-right: -47px;
  }

  .tools8:hover {
    width: 150px;
  }

  .p {
    padding: 10px 0;
    font-size: 15px;
  }

  .el-checkbox {
    font-weight: 500;
    font-size: 14px;
    position: relative;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  .tab-content-item {
    display: flex;
    align-items: center;
  }

  .tab-content-item > div {
    display: flex;
    align-items: center;
    flex: 1;
    -ms-flex-align: center;
    padding: 10px;
    border-bottom: 1px solid #e8e8e8;
  }

  .flex-1 {
    flex: 1;
  }

  input {
    margin-left: -8px;
    padding-left: 8px;
    height: 25px;
    width: 100%;
  }

  .spn {
    display: inline-block;
  }

  .san {
    display: inline-block;
    padding: 0 10px;
    margin: 5px;
    border-radius: 5px;
    background-color: #909399;
  }

  .green {
    background-color: #7b9e02;
  }

  .yellow {
    background-color: #deb81b;
  }

  .dark_green {
    background-color: #1f9e91;
  }

  .red {
    background-color: #e85656;
  }

  .frame {
    display: inline-block;
    white-space: nowrap;
    border-radius: 5px;
    margin: 3px 5px;
    cursor: pointer;
    border: 1px solid #909399;
    background-color: #909399;
    color: #fff;
    text-align: center;
    padding: 5px 10px;
  }


</style>
<style>
  .ivu-input-wrapper {
    padding-left: 20px;
  }
</style>
